import request from '@/utils/request'

const api_name = '/eduservice/course'

export default {
  saveCourseInfo(courseInfo) {
    return request({
      url: `${api_name}/info`,
      method: 'post',
      data: courseInfo
    })
  },
  //根据ID查询课程信息 
  getCourseInfoById(id){
    return request({
      url: `${api_name}/${id}`,
      method: 'get'
    })
  },
  updateCourseId(courseInfo){
    
    return request({
      url: `${api_name}/updateCourse/${courseInfo.id}`,
      method: 'post',
      data: courseInfo
    })
  },
  //获取课程详情
  getCourseSubTeacherInfo(id){
    return request({
      url: `${api_name}/getCourseSubTeacherInfo/${id}`,
      method: 'get'
    })
  },
  publishCourse(id){
    return request({
      url: `${api_name}/publishCourse/${id}`,
      method: 'put'
    })
  },
  //查询所有的课程
  getPageList(page, limit, searchObj) {
    return request({
      url: `${api_name}/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },
  removeById(id) {
    return request({
        url: `${api_name}/${id}`,
        method: 'delete'
    })
}
}